

layout(triangles) in;
layout(triangle_strip, max_vertices = 48) out;

uniform int level;
layout(std140) uniform lightSpaceMatricesData { mat4 lightSpaceMatrices[16]; };
void main() {

  for (int i = 0; i < level; ++i) {
    for (int j = 0; j < 3; ++j) {
      gl_Position = lightSpaceMatrices[i] * gl_in[j].gl_Position;
      gl_Layer = i;
      EmitVertex();
    }
    EndPrimitive();
  }
}